package cn.xiangxiang.controller.exception;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import java.util.HashMap;
import java.util.Map;

@RestControllerAdvice
public class MyException {


    @ExceptionHandler(Exception.class)
    public Map<String,Object> exc(Exception ex){
        HashMap<String, Object> map = new HashMap<>();
        map.put("code",9999);
        map.put("msg","执行失败");
        map.put("ex",ex.getMessage());
        return map;
    }
}
